home *** CD-ROM | disk | FTP | other *** search
Text File | 1986-01-22 | 946 b | 48 lines | [TEXT/ttxt] |
- \ 2 Dimensional Array
- \ 3/01/85 rw
- \ 1/07/86 cdn Added print: method
-
- :CLASS 2dArray <Super Array 4 <Indexed
-
- Int xbound
-
- \ ( xbound -- ) Store x bound; y bound already used by super Array
- :M CLASSINIT: put: xbound ;M
-
- \ ( -- ) Allocate arrays for second dimension
- :M NEW:
- limit: super 0
- DO
- get: xbound heap> array i to: super
- LOOP
- ;M
-
- \ ( val x y -- )
- :M TO: to: [ at: super ] ;M
-
- \ ( x y -- )
- :M AT: at: [ at: super ] ;M
-
- \ ( -- ) Deallocate array space in heap
- :M DISPOSE:
- limit: super 0
- DO
- i at: super killptr
- LOOP
- ;M
-
- :M XLIMIT: get: xbound ;M
-
- :M YLIMIT: limit: super ;M
-
- :M PRINT: ylimit: self 0
- DO CR
- xlimit: self 0
- DO
- i j at: self .
- LOOP
- LOOP
- ;M
-
- ;CLASS
-